/**
 * 
 */
package chatsystem;

import java.util.ArrayList;

/**
 * @author Thibaut POUZET
 *
 */

public class ArraylistAdapter implements CollectionContactTarget {

	private ArrayList<Contact> t = new ArrayList<Contact>();
	
	private Contact find(String nname) {
		int i=0;
		while(t.get(i).getNickname() != nname){
			i++;
		}
		return t.get(i);
	}
	
	
	public void add(Contact contact) {
		t.add(contact);
	}
	
	
	public void remove(String nname) {
		t.remove(this.find(nname));

	}
	
	public void removeAll() {
		t.removeAll(t);
	}
	
	
	
	public Iterator iterator() {
		
	}

	public Contact get(String nname) {
		
		return this.find(nname);
	}
	
}
